package net.alche.fa.core.doing;

import net.alche.fa.core.model.Logic;
import net.alche.fa.core.model.FaValue;
import net.alche.fa.core.CodeLevel;
import net.alche.fa.core.SageStone;
import net.alche.fa.core.FaException;

@FaAnnoDoing
public class ThrowDo extends AbstractDoing {
  @Override
  public boolean matched(String what, Logic g) {
    return "throw".equals(what);
  }

  @Override
  public FaValue doing(Logic g, CodeLevel lvl, SageStone st) throws FaException {
    // CodeLevel cl = lvl.instanceDeep();
    lvl.doChild = false;
    FaValue fav = getLogicObjVal(st, lvl, g);
    throw new FaException(fav);
  }

}
